#pragma once

#include "SPD3D11Prerequisite.h"
#include "XNACollision.h"
#include "ParticleSystem/SPEmitter.h"

namespace SP
{
	// class
	class DLL_EXPORT SPCollisionObject
	{
	public:
		enum
		{
			eCollisionObj_None = 0,
			eCollisionObj_Box,
			eCollisionObj_Sphere,
			// eCollisionObj_Ray,
			// eCollisionObj_Frustum,
		};

		SPCollisionObject();
		SPCollisionObject( const OrientedBox* pBox );
		SPCollisionObject( const Sphere* pSphere );

		void SetObj( const OrientedBox* pBox );
		void SetObj( const Sphere* pSphere );

		~SPCollisionObject();
		bool Intersect( SPCollisionObject* pOther );
		bool IntersectRay( FXMVECTOR Origin, FXMVECTOR Direction, FLOAT* pDist );

		UINT m_nCollisionoObjectType;
		void *m_pCollisionObj;

	};

	typedef std::vector<SPCollisionObject*> SPCollisionObjectVector;

	class DLL_EXPORT SPCollisionComponent
	{
	public:
		SPCollisionComponent();
		SPCollisionComponent( const WCHAR* file );
		~SPCollisionComponent();

		void SaveCollisionComponentToFile( const WCHAR* file );
		
		void CreateFileBuffer( SPFileBuffer* pFB );
		void CreateFromFileBuffer( BYTE* pBufPtr );

		bool Intersect( SPCollisionComponent* pOther );
		void Draw();

		SPCollisionObjectVector m_CollisionObjVector;
		SPCollisionObject* m_pOutline;
	};

}